package api

import (
	"github.com/gin-gonic/gin"
	"zy11/api/handler"
	"zy11/api/middleware"
	"zy11/pkg/jwt"
)

func Router(r *gin.Engine) {
	r.Use(middleware.Token())
	user := r.Group("user")
	{
		user.POST("/login", handler.Login)
		user.Use(jwt.JWTAuth(handler.JWT_USER_ID))
		user.GET("/ws", handler.Chat)
	}
	room := r.Group("room")
	{
		room.Use(jwt.JWTAuth(handler.JWT_USER_ID))
		room.POST("/addRoom", handler.AddRoom)
		room.POST("addRoomUser", handler.AddRoomUser)
		//	room.POST("addRoomUser", handler.AddRoomUser)
	}
}
